<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center guomingshi_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between flex-sub guomingshi_fd0_0'>
					<view class='flex flex-wrap align-center guomingshi_fd0_0_c0' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  guomingshi_fd0_0_c0_c0'>&#xE794;</text>
					</view>
					<view class='flex flex-wrap align-stretch justify-center'>
						<text class='guomingshi_fd0_0_c1_c0' v-if="type==1">过敏史</text>
						<text class='guomingshi_fd0_0_c1_c0' v-if="type==2">既往病史</text>
					</view>
					<view class='flex flex-wrap align-center justify-end guomingshi_fd0_0_c0'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="flex benben-flex-layout flex-wrap align-center">
				<view class='flex flex-wrap align-center guomingshi_fd1_0'>
					<view class='flex flex-wrap align-center guomingshi_fd1_0_c0'>
						<text class='guomingshi_fd1_0_c0_c0' v-if="type==1">过敏史</text>
						<text class='guomingshi_fd1_0_c0_c0' v-if="type==2">既往病史</text>
					</view>
					<view class='flex flex-wrap align-center guomingshi_fd1_0_c1' v-if="type==1">
						<view class='flex flex-wrap guomingshi_fd1_0_c1_c0'>
							<textarea class='flex guomingshi_input_fd1_0_c1_c0' :placeholder="'请详细描述您的过敏史'"
								:adjust-position="false" :maxlength="800" :show-num='true'
								placeholder-style="color:#999;font-size:28rpx" v-model="allergy" />
							<template>
								<view class='flex flex justify-end guomingshi_numberfd1_0_c1_c0_c0'>
									<text>{{allergy.length}}</text>
									<text class='guomingshi_numberfd1_0_c1_c0_c0_c1'>/</text>
									<text>800</text>
								</view>
							</template>
						</view>
					</view>
					<view class='flex flex-wrap align-center guomingshi_fd1_0_c1' v-if="type==2">
						<view class='flex flex-wrap guomingshi_fd1_0_c1_c0'>
							<textarea class='flex guomingshi_input_fd1_0_c1_c0' :placeholder="'请详细描述您的既往病史'"
								:adjust-position="false" :maxlength="800" :show-num='true'
								placeholder-style="color:#999;font-size:28rpx" v-model="medical_history" />
							<template>
								<view class='flex flex justify-end guomingshi_numberfd1_0_c1_c0_c0'>
									<text>{{medical_history.length}}</text>
									<text class='guomingshi_numberfd1_0_c1_c0_c0_c1'>/</text>
									<text>800</text>
								</view>
							</template>
						</view>
					</view>
				</view>
				<button class='guomingshi_fd1_1' @click="submitclick">确定</button>
			</view>

			<!---flex布局flex布局结束-->


		</view>
	</view>
</template>
<script>
	export default {
		components: {},


		data() {
			return {
				allergy:"",
				medical_history:"",
				"type": "1"
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			let {
				type
			} = options
			if (type !== undefined) this.type = type;
			this.getOrderTagFunc();
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			getOrderTagFunc(){
				this.$api.post(global.apiUrls.post5c78c4772da97, {
				
				}).then(res=>{
					if(res.data.code==1){
						this.medical_history = res.data.data.medical_history;
						this.allergy = res.data.data.allergy;
					}
				})
			},
			
			//提交修改过敏史和既往病史
			submitclick(){
				this.$api.post(global.apiUrls.post5cb54af125f1c, {
					allergy:this.allergy,
					medical_history:this.medical_history,
				}).then(res=>{
					if(res.data.code==1){
						this.$message.info("修改成功")
						setTimeout(function(){
							uni.navigateBack()
						},800)
					}
				})
			},
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: var(--benbenbgColor1);
		background-size: 100% auto;
	}

	.guomingshi_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.guomingshi_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 700;
		color: #333333;
		line-height: 50rpx;
	}

	.guomingshi_fd0_0_c0_c0 {
		font-size: 36rpx;
		color: #333;
	}

	.guomingshi_fd0_0_c0 {
		width: 120rpx;
	}

	.guomingshi_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.guomingshi_fd1_1 {
		border-top: 1px solid rgba(238, 238, 238, 1);
		background: var(--benbenbgColor1);
		width: 100%;
		line-height: 98rpx;
		font-size: 32rpx;
		color: #A23C30;
		height: 98rpx;
		position: fixed;
		bottom: calc(0rpx + var(--window-bottom));
		left: 0rpx;
		font-weight: 400;
	}

	.guomingshi_numberfd1_0_c1_c0_c0_c1 {
		color: rgba(153, 153, 153, 1);
	}

	.guomingshi_numberfd1_0_c1_c0_c0 {
		width: 100%;
		font-size: 24rpx;
		color: rgba(153, 153, 153, 1);
		line-height: 46rpx;
		font-weight: 400;
	}

	.guomingshi_input_fd1_0_c1_c0 {
		width: 686rpx;
		height: 140rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
		white-space: pre-wrap;
	}

	.guomingshi_fd1_0_c1_c0 {
		background: rgba(246, 246, 246, 1);
		width: 686rpx;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		padding: 10rpx;
		margin: 0rpx 0rpx 0rpx 0rpx;
	}

	.guomingshi_fd1_0_c1 {
		width: 100%;
		margin: 24rpx 0rpx 0rpx 0rpx;
	}

	.guomingshi_fd1_0_c0_c0 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 400;
	}

	.guomingshi_fd1_0_c0 {
		margin: 40rpx 0rpx 0rpx 0rpx;
		width: 100%;
	}

	.guomingshi_fd1_0 {
		width: 686rpx;
		margin: 0rpx 0rpx 0rpx 32rpx;
	}
</style>